#include <cstdio>
#include "ca.h"
#include "targetfindinggrid.h"


CA::CA():step(0)
{
}

CA::~CA()
{
    delete current_states;
    delete new_states;
}


int CA::getStep()const
{
    return step;
}


Grid* CA::grid_copy()const
{
    return new TargetFindingGrid(dynamic_cast<TargetFindingGrid*>(current_states));
}

void CA::set(const Grid& grid)
{
    this->step=0;
    this->current_states = new TargetFindingGrid(dynamic_cast<const TargetFindingGrid&>(grid));
    this->new_states = new TargetFindingGrid(dynamic_cast<const TargetFindingGrid&>(grid));
}
